package cn.aitrox.ry.service.anno.controller;

import cn.aitrox.ry.bean.RespResult;
import cn.aitrox.ry.common.controller.BaseController;
import cn.aitrox.ry.service.anno.api.LesionResultApi;
import cn.aitrox.ry.service.anno.dto.anno.lesion.result.in.AlrLesionUpdateInDto;
import cn.aitrox.ry.service.anno.dto.anno.lesion.result.in.AlrMaskCreateInDto;
import cn.aitrox.ry.service.anno.dto.anno.lesion.result.in.AlrMaskUpdateInDto;
import cn.aitrox.ry.service.anno.dto.anno.lesion.result.in.AlrPointCreateInDto;
import cn.aitrox.ry.service.anno.dto.anno.lesion.result.in.AlrPointUpdateInDto;
import cn.aitrox.ry.service.anno.service.AnnoLesionResultService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class LesionResultController extends BaseController implements LesionResultApi {

    @Autowired
    private AnnoLesionResultService annoLesionResultService;

    @PostMapping(value = "/anno/lesion/result/point")
    @Override
    public RespResult<Integer> pointCreate(@RequestBody AlrPointCreateInDto input) {
        return annoLesionResultService.pointCreate(input);
    }

    @PutMapping(value = "/anno/lesion/result/point")
    @Override
    public RespResult pointUpdate(@RequestBody AlrPointUpdateInDto input) {
        return annoLesionResultService.pointUpdate(input.getAlrId(), input.getResult(), input.getColor());
    }

    @DeleteMapping(value = "/anno/lesion/result/{alrId}")
    @Override
    public RespResult delete(@PathVariable("alrId") Integer alrId) {
        return annoLesionResultService.delete(alrId);
    }

    @PostMapping(value = "/anno/lesion/result/mask")
    @Override
    public RespResult<Integer> maskCreate(@Validated @RequestBody AlrMaskCreateInDto input) {
        return annoLesionResultService.maskCreate(input);
    }

    @PutMapping(value = "/anno/lesion/result/mask")
    @Override
    public RespResult maskUpdate(@Validated @RequestBody AlrMaskUpdateInDto input) {
        return annoLesionResultService.maskUpdate(input);
    }

    @PutMapping(value = "/anno/lesion/result/lesion/update")
    @Override
    public RespResult lesionUpdate(@Validated @RequestBody AlrLesionUpdateInDto input) {
        return annoLesionResultService.lesionUpdate(input.getAlrId(), input.getLesion());
    }
}
